package com.dsbridge.bank.controllers;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.dsbridge.bank.business.AccountBusineessServiceInterface;
import com.dsbridge.bank.model.Account;

@Controller
public class AccountController {

	@Autowired
	AccountBusineessServiceInterface accSer;

	@RequestMapping(value = "/accsubmited.mvc")
	public ModelAndView accountreg(@ModelAttribute("account") Account account)
			throws Exception {

		accSer.insert(account);
		ModelAndView modelAndView = new ModelAndView("accountregsucessful.jsp");
		modelAndView.addObject("account", account);
		return modelAndView;
		
}
	
	

	@RequestMapping(value = "/accupdated.mvc")
	public ModelAndView update(@ModelAttribute("account") Account account)
			throws Exception {

		accSer.update(account);
		ModelAndView modelAndView = new ModelAndView("updateaccsucessful.jsp");
		modelAndView.addObject("account", account);
		return modelAndView;
		
}
	@RequestMapping(value = "/accdelete.mvc")
	public ModelAndView delete(@ModelAttribute("account") Account account)
			throws Exception {

		accSer.delete(account);
		ModelAndView modelAndView = new ModelAndView("accdeletesucessful.jsp");
		modelAndView.addObject("account", account);
		return modelAndView;
}
}
